<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.1.1
Version: 2.0.2
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<!--<![endif]-->
<!-- BEGIN HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
	<!-- BEGIN CONTAINER -->
	<!-- BEGIN CONTENT -->
	<!--表格操作按钮组-->
	<div>
		<a class="btn blue" href="javascript:;"
			data-target="#accountingRuleModel" data-toggle="modal"
			ng-click="addAccountingRule();"> <i class="fa fa-plus"></i> 新增
		</a>
	</div>
	<table class="table table-striped table-bordered table-hover"
		id="table_1">
		<thead>
			<tr>
				<th>服务名称</th>
				<th>子服务名称</th>
				<th>一级科目</th>
				<th>二级科目</th>
				<th>借贷标志</th>
				<th>余额标志</th>
				<th>是否使用</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<tr class="odd gradeX"
				ng-repeat="accountingRule in accountingRuleList  track by $index"
				on-loaded="{{$last}}" target-table="table_1">
				<td><span
					ng-bind="accountingRule.serviceNo | getValueInArgFilter : orderServiceMap : 'name'"></span>
				</td>
				<td><span
					ng-bind="accountingRule.subServiceNo | getValueInArgFilter : orderServiceMap : 'name'"></span>
				</td>
				<td><span
					ng-bind="accountingRule.subjectCode | getValueInArgFilter : subjectMap : 'subjectName'"></span>
				</td>
				<td><span
					ng-bind="accountingRule.subSubjectCode | getValueInArgFilter : subjectMap : 'subjectName'"></span>
				</td>
				<td><span
					ng-bind="accountingRule.loanFlag | getValueInStaticFilter : 'loanFlagArray'"></span>
				</td>
				<td><span
					ng-bind="accountingRule.balanceFlag | getValueInStaticFilter : 'balanceFlagArray'"></span>
				</td>
				<td><span
					ng-bind="accountingRule.isValid | getValueInStaticFilter : 'validArray'"></span>
				</td>
				<td><a class="btn" href="javascript:;"
					data-target="#accountingRuleModel" data-toggle="modal"
					ng-click="updateAccountingRule(accountingRule);"> 修改 </a> <!-- <a
					class="btn" href="javascript:;"
					data-target="#subAccountingRuleList" data-toggle="modal"
					ng-click="showSubAccountingRuleList(accountingRule);"> 调配子规则 </a> --></td>
			</tr>
		</tbody>
	</table>

	<div id="accountingRuleModel" class="modal fade" role="dialog"
		aria-hidden="true" data-backdrop="false">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title">子服务记账规则新增/修改</h4>
				</div>
				<div class="modal-body form">
					<div class="form-group">
						<div class="row">
							<label class="col-sm-3 control-label text-right">主服务</label>
							<div class="col-sm-8">
								<div class="input-group">
									<select class="form-control bValidate" key="required"
										ng-options="orderService.serviceNo as orderService.name for orderService in rootOrderService"
										ng-model="selectedAccountingRule.serviceNo"
										ng-change="showOrderService();">
										<option value="">请选择主服务</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">子服务</label>
							<div class="col-sm-8">
								<div class="input-group">
									<select class="form-control bValidate" key="required"
										ng-options="orderService.serviceNo as orderService.name for orderService in childrenOrderService"
										ng-model="selectedAccountingRule.subServiceNo">
										<option value="">请选择子服务</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">一级科目</label>
							<div class="col-sm-8">
								<div class="input-group">
									<select class="form-control bValidate" key="required"
										ng-options="subject.subjectCode as subject.subjectName  for subject in accountingRuleSuject "
										ng-model="selectedAccountingRule.subjectCode"
										ng-change="showSubject()">
										<option value="">请选择一级科目</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">二级科目</label>
							<div class="col-sm-8">
								<div class="input-group">
									<select class="form-control bValidate" key="required"
										ng-options="subject.subjectCode as subject.subjectName for subject in childrenSubject "
										ng-model="selectedAccountingRule.subSubjectCode">
										<option value="">请选择二级科目</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">借贷标志</label>
							<div class="col-md-8">
								<div class="radio-list">
									<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input  class="bValidate" key="required"
										ng-model="selectedAccountingRule.loanFlag" type="radio"
										value="0" ng-selected="selectedAccountingRule.loanFlag==0"  name="selectedAccountingRule.loanFlag">
										借
									</label> <label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedAccountingRule.loanFlag" type="radio"
										value="1" ng-selected="selectedAccountingRule.loanFlag==1"  name="selectedAccountingRule.loanFlag">
										贷
									</label>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">余额标志</label>
							<div class="col-md-8">
								<div class="radio-list">
									<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input  class="bValidate" key="required"
										ng-model="selectedAccountingRule.balanceFlag" type="radio"  name="selectedAccountingRule.balanceFlag"
										value="1" ng-selected="selectedAccountingRule.balanceFlag==1">
										增加
									</label> <label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedAccountingRule.balanceFlag" type="radio"  name="selectedAccountingRule.balanceFlag"
										value="0" ng-selected="selectedAccountingRule.balanceFlag==0">
										减少
									</label>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">是否启用</label>
							<div class="col-md-8">
								<div class="radio-list">
									<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedAccountingRule.isValid" type="radio"  name="selectedAccountingRule.isValid"
										value="1" ng-selected="selectedAccountingRule.isValid==1">
										启用
									</label> <label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedAccountingRule.isValid" type="radio"  name="selectedAccountingRule.isValid"
										value="0" ng-selected="selectedAccountingRule.isValid==0">
										停用
									</label>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">
						<i class="fa fa-times"></i>关闭
					</button>
					<button type="button" class="btn btn-primary"
						ng-click="modifyAccountingRule();">
						<i class="fa fa-check"></i>保存
					</button>
				</div>
			</div>
		</div>
	</div>
	<div id="subAccountingRuleList" class="modal fade" role="dialog"
		aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title">记账子规则管理</h4>
				</div>
				<div class="modal-body form">
					<div class="form-group">
						<div class="table_btn_box">
							<a class="btn blue" href="javascript:;"
								data-target="#subAccountingRuleModel" data-toggle="modal"
								ng-click="addSubAccountingRule();"> <i class="fa fa-plus"></i>
								新增
							</a>
						</div>
						<table class="table table-striped table-bordered table-hover"
							id="table_2">
							<thead>
								<tr>
									<th>一级科目</th>
									<th>二级科目</th>
									<th>借贷标志</th>
									<th>余额标志</th>
									<th>是否使用</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<tr class="odd gradeX"
									ng-repeat="subAccountingRule in subAccountingRuleList  track by $index"
									on-loaded="{{$last}}" target-table="table_2">
									<td><span
										ng-bind="subAccountingRule.subjectCode | getValueInArgFilter : subjectMap : 'subjectName'"></span>
									</td>
									<td><span
										ng-bind="subAccountingRule.subSubjectCode | getValueInArgFilter : subjectMap : 'subjectName'"></span>
									</td>
									<td><span
										ng-bind="subAccountingRule.loanFlag | getValueInStaticFilter : 'loanFlagArray'"></span>
									</td>
									<td><span
										ng-bind="subAccountingRule.balanceFlag | getValueInStaticFilter : 'balanceFlagArray'"></span>
									</td>
									<td><span
										ng-bind="subAccountingRule.isValid | getValueInStaticFilter : 'validArray'"></span>
									</td>
									<td><a class="btn" href="javascript:;"
										data-target="#subAccountingRuleModel" data-toggle="modal"
										ng-click="updateSubAccountingRule(subAccountingRule,$index);">
											修改 </a></td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">
						<i class="fa fa-times"></i>关闭
					</button>
				</div>
			</div>
		</div>
	</div>
	<div id="subAccountingRuleModel" class="modal fade" role="dialog"
		aria-hidden="true" data-backdrop="false">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title">子服务记账规则新增/修改</h4>
				</div>
				<div class="modal-body form">
					<div class="form-group">

						<div class="row">
							<label class="col-sm-3 control-label text-right">一级科目</label>
							<div class="col-sm-8">
								<div class="input-group">
									<select class="form-control bValidate" key="required"
										ng-options="subject.subjectCode as subject.subjectName  for subject in rootSubjct "
										ng-model="selectedSubAccountingRule.subjectCode"
										ng-change="subShowSubject()">
										<option value="">请选择一级科目</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">二级科目</label>
							<div class="col-sm-8">
								<div class="input-group">
									<select class="form-control bValidate" key="required"
										ng-options="subject.subjectCode as subject.subjectName for subject in subChildrenSubject "
										ng-model="selectedSubAccountingRule.subSubjectCode">
										<option value="">请选择二级科目</option>
									</select>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">借贷标志</label>
							<div class="col-md-8">
								<div class="radio-list">
									<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input class="bValidate" key="required"
										ng-model="selectedSubAccountingRule.loanFlag" type="radio"  name="selectedSubAccountingRule.loanFlag"
										value="0" ng-selected="selectedSubAccountingRule.loanFlag==0">
										借
									</label> <label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedSubAccountingRule.loanFlag" type="radio" name="selectedSubAccountingRule.loanFlag"
										value="1" ng-selected="selectedSubAccountingRule.loanFlag==1">
										贷
									</label>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">余额标志</label>
							<div class="col-md-8">
								<div class="radio-list">
									<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input class="bValidate" key="required"
										ng-model="selectedSubAccountingRule.balanceFlag" type="radio"
										value="1"  name="selectedSubAccountingRule.balanceFlag"
										ng-selected="selectedSubAccountingRule.balanceFlag==1">
										增加
									</label> <label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedSubAccountingRule.balanceFlag" type="radio"
										value="0"  name="selectedSubAccountingRule.balanceFlag"
										ng-selected="selectedSubAccountingRule.balanceFlag==0">
										减少
									</label>
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-3 control-label text-right">是否启用</label>
							<div class="col-md-8">
								<div class="radio-list">
									<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedSubAccountingRule.isValid" type="radio" name="selectedSubAccountingRule.isValid"
										value="1" ng-selected="selectedSubAccountingRule.isValid==1">
										启用
									</label> <label  class="radio-inline col-md-4" style="margin:0px;padding: 0px"> <input
										ng-model="selectedSubAccountingRule.isValid" type="radio" name="selectedSubAccountingRule.isValid"
										value="0" ng-selected="selectedSubAccountingRule.isValid==0">
										停用
									</label>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">
						<i class="fa fa-times"> </i>关闭
					</button>
					<button type="button" class="btn btn-primary"
						ng-click="modifySubAccountingRule();">
						<i class="fa fa-check"></i>保存
					</button>
				</div>
			</div>
		</div>
	</div>
	</div>
	<!-- END CONTENT -->

	<!-- END CONTAINER -->

	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->



</body>
<!-- END BODY -->
</html>
<script src="manageView/assets/scripts/public.js" type="text/javascript"></script>
<script>
	// setTimeout(function(){
	// 	var tablesOption = datatableOption;
	// var table1 = $('#table_1');
	// var tb1 = table1.DataTable(tablesOption);
	// }, 3000);
</script>